#ifndef _OBJECTS_H_
#define _OBJECTS_H_

#include "thing.h"
#include "allocator.h"

// A file for any Things and dependent information

void InitObjects();

#define ALL_SYMBOLS				\
  /* from function model */			\
  _SYMBOL(MODELDL)				\
  _SYMBOL(RUNEXECUTION)				\
  _SYMBOL(NTH)					\
  _SYMBOL(COUNT)				\
  _SYMBOL(CONTAINS)				\
  _SYMBOL(SIZE)					\
  _SYMBOL(CALLTIME)				\
  _SYMBOL(EXECUTION)				\
  _SYMBOL(XTIME)				\
  _SYMBOL(DEPENDENTS)				\
  _SYMBOL(DEFINITIONS)				\
  _SYMBOL(FDTOCALLS)				\
  _SYMBOL(MISSING_CALLS)			\
  _SYMBOL(EARLY_CALLS)				\
  _SYMBOL(FORCE)				\
  _SYMBOL(NUMIMPROVEMENTS)			\
  _SYMBOL(INTERESTING_FUNCTIONS)		\
  _SYMBOL(FUNCTIONS)				\
  _SYMBOL(COMPUTED)				\
  _SYMBOL(OVERRIDE)				\
  _SYMBOL(KERNEL_VERIFY)			\
  _SYMBOL(FUNCTION_ARGS)			\
  /* misc */					\
  _SYMBOL(WEIGHT)				\
  _SYMBOL(NOTIMPLEMENTED)			\
  _SYMBOL(RESULT)				\
  /* from problem */				\
  _SYMBOL(CORPUS)				\
  _SYMBOL(ALL_ARGUMENTS)                        \
  _SYMBOL(TRAINING_ARGUMENT)                    \
  _SYMBOL(TEST_ARGUMENT)                        \
  _SYMBOL(PREDICTION_ARGUMENT)                  \
  /* from interpreter */			\
  _SYMBOL(ALL)                                  \
  _SYMBOL(SELF)					\
  _SYMBOL(REST)					\
  _SYMBOL(MREST)				\
  _SYMBOL(TYPE_EXCEPTION)			\
  _SYMBOL(UNKNOWN_EXCEPTION)			\
  _SYMBOL(ARITHMETIC_EXCEPTION)			\
  _SYMBOL(STACK_EXCEPTION)			\
  _SYMBOL(COMPILE_SYNTAX_EXCEPTION)		\
  _SYMBOL(ARITY_EXCEPTION)			\
  _SYMBOL(OVERTIME_EXCEPTION)			\
  _SYMBOL(OUT_OF_RANGE_EXCEPTION)		\
  _SYMBOL(UNKNOWN_SYSCALL_EXCEPTION)		\
  _SYMBOL(BAD_OVERLAY_EXCEPTION)		\
  _SYMBOL(TABLESET_EXCEPTION)                   \
  _SYMBOL(VERIFY_EXECUTION_EXCEPTION)		\
  _SYMBOL(MODEL_EXCEPTION)			\
  _SYMBOL(GLOBAL_NOT_FOUND_EXCEPTION)           \
  _SYMBOL(ABSENT)				\
  _SYMBOL(PRESENT)				\
  _SYMBOL(MISSING)				\
  /* from economy */				\
  _SYMBOL(CODE)					\
  _SYMBOL(IMPROVEMENT)				\
  _SYMBOL(DEMAND)				\
  _SYMBOL(ECONOMY_MODE)                         \
  _SYMBOL(GENERATIVE_MODE)                      \

#define ALL_SYSCALLS				\
  /* --- economy syscalls --- */		\
  _SYSCALL(SAMPLE, e)				\
  _SYSCALL(RANGEWEIGHT, e)			\
  _SYSCALL(RANGECOUNT, e)                       \
  _SYSCALL(READALL, e)				\
  _SYSCALL(POST, e)				\
  _SYSCALL(TEST, e)				\
  _SYSCALL(ENTITIES, e)				\
  _SYSCALL(SLEEP, e)				\
  _SYSCALL(FLUSH, e)				\
						\
  /* --- problem --- */				\
  _SYSCALL(PROBLEM_NUM_FUNCTIONS, a)	      	\
  _SYSCALL(PROBLEM_NTH_FUNCTION, a)    		\
  _SYSCALL(PROBLEM_NUM_ARGS, a)			\
  _SYSCALL(PROBLEM_NTH_ARG, a)		       	\
  _SYSCALL(PROBLEM_ARG_TYPE, a)		       	\
  _SYSCALL(PROBLEM_DESCRIPTION, e)              \
  _SYSCALL(PROBLEM_IMPLICIT_RESULT, e)		\
  _SYSCALL(PROBLEM_CORRECT_RESULT, e)           \
  						\
  /* --- data (lexicon + corpus) --- */		\
  _SYSCALL(LEXICONSIZE, a)			\
  _SYSCALL(TOKENIZE, a)				\
  _SYSCALL(SEARCH, e)				\
  _SYSCALL(SUFFIX, e)				\
						\
  /* --- model / economy mode --- */		\
  _SYSCALL(NEWOVERLAY, e)			\
  _SYSCALL(LOCKOVERLAY, e)			\
  _SYSCALL(BADOVERLAY, e)			\
  _SYSCALL(ADDXTIME, e)				\
  _SYSCALL(REMOVEXTIME, e)			\
  _SYSCALL(TABLESET, e)				\
  _SYSCALL(TABLELOOK, e)			\
						\
  /* --- generative mode --- */			\
  _SYSCALL(MODELCALL, g)			\

  
#define _SYSCALL(name,mode) SYSCALL_##name,
enum Syscall { ALL_SYSCALLS };
#undef _SYSCALL

#define _SYSCALL(name, mode) extern Thing name;
ALL_SYSCALLS;
#undef _SYSCALL

#define _SYMBOL(name) extern Thing name;
ALL_SYMBOLS;
#undef _SYMBOL

#endif
